load("@rules_go//go:def.bzl", "go_binary", "go_library")
load("//private/rules:rules.bzl", "installable_binary")

go_library(
    name = "pachctl_lib",
    srcs = ["main.go"],
    importpath = "github.com/pachyderm/pachyderm/v2/src/server/cmd/pachctl",
    visibility = ["//visibility:private"],
    deps = [
        "//src/internal/errors",
        "//src/internal/log",
        "//src/internal/pctx",
        "//src/internal/tracing",
        "//src/server/cmd/pachctl/cmd",
        "@com_github_spf13_pflag//:pflag",
    ],
)

go_binary(
    name = "pachctl",
    embed = [":pachctl_lib"],
    pure = "on",
    visibility = ["//visibility:public"],
    x_defs = {
        "github.com/pachyderm/pachyderm/v2/src/version.AppVersion": "{STABLE_APP_VERSION}",
        "github.com/pachyderm/pachyderm/v2/src/version.AdditionalVersion": "{STABLE_ADDITIONAL_VERSION}",
    },
)

# Running this target installs a pachctl binary into your $PATH.
installable_binary(
    name = "install",
    installed_name = "pachctl",
    target = ":pachctl",
)
